/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author LYS
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface CroreWddw extends BasicModel<CroreWddw> {
  wddwDwmc?: string; // 单位名称
  wddwLxr?: string; // 联系人
  wddwLxrdh?: string; // 联系人电话
}

export const croreWddwList = (params?: CroreWddw | any) =>
  defHttp.get<CroreWddw>({ url: adminPath + '/bas/cus/croreWddw/list', params });

export const croreWddwListData = (params?: CroreWddw | any) =>
  defHttp.post<Page<CroreWddw>>({ url: adminPath + '/bas/cus/croreWddw/listData', params });

export const croreWddwForm = (params?: CroreWddw | any) =>
  defHttp.get<CroreWddw>({ url: adminPath + '/bas/cus/croreWddw/form', params });

export const croreWddwSave = (params?: any, data?: CroreWddw | any) =>
  defHttp.postJson<CroreWddw>({ url: adminPath + '/bas/cus/croreWddw/save', params, data });

export const croreWddwImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/bas/cus/croreWddw/importData',
      onUploadProgress,
    },
    params,
  );

export const croreWddwDelete = (params?: CroreWddw | any) =>
  defHttp.get<CroreWddw>({ url: adminPath + '/bas/cus/croreWddw/delete', params });

export const croreWddwTreeData = (params?: CroreWddw | any) =>
  defHttp.get<CroreWddw>({ url: adminPath + '/bas/cus/croreWddw/treeData', params });
